home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / x11 / x-iso8859-1.el < prev    next >
Encoding:
Text File  |  1995-03-25  |  8.0 KB  |  294 lines

  1. ;; Mapping between X keysym names and ISO 8859-1 (aka Latin1) character codes.
  2. ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of XEmacs.
  5.  
  6. ;; XEmacs is free software; you can redistribute it and/or modify it
  7. ;; under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; XEmacs is distributed in the hope that it will be useful, but
  12. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. ;; General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  18. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. ;; created by jwz, 13-jun-92.
  21.  
  22. ;; Under X, when the user types a character that is ISO-8859/1 but not ASCII,
  23. ;; it comes in as a symbol instead of as a character code.  This keeps things
  24. ;; nice and character-set independent.  This file takes all of those symbols
  25. ;; (the symbols that are the X names for the 8859/1 characters) and puts a
  26. ;; property on them which holds the character code that should be inserted in
  27. ;; the buffer when they are typed.  The self-insert-command function will look
  28. ;; at this.  It also binds them all to self-insert-command.
  29.  
  30. ;; It puts the same property on the keypad keys, so that (read-char) will
  31. ;; think that they are the same as the digit characters.  However, those
  32. ;; keys are bound to one-character keyboard macros, so that `kp_9' will, by
  33. ;; default, do the same thing that `9' does, in whatever the current mode is.
  34.  
  35. ;; The standard case and syntax tables are set in prim/iso8859-1.el, since
  36. ;; that is not X-specific.
  37.  
  38. (require 'iso8859-1)
  39.  
  40. (defconst iso8859/1-code-to-x-keysym-table nil
  41.   "Maps iso8859/1 to an X keysym name which corresponds to it.
  42. There may be more than one X name for this keycode; this returns the first one.
  43. Note that this is X specific; one should avoid using this table whenever 
  44. possible, in the interest of portability.")
  45.  
  46. ;; (This esoteric little construct is how you do MACROLET in elisp.  It
  47. ;; generates the most efficient code for the .elc file by unwinding the
  48. ;; loop at compile-time.)
  49.  
  50. ((macro
  51.   . (lambda (&rest syms-and-iso8859/1-codes)
  52.       (cons
  53.        'progn
  54.        (nconc
  55.     ;;
  56.     ;; First emit code that puts the `x-iso8859/1' property on all of
  57.     ;; the keysym symbols.
  58.     ;; 
  59.     (mapcar '(lambda (sym-and-code)
  60.            (list 'put (list 'quote (car sym-and-code))
  61.              ''x-iso8859/1 (car (cdr sym-and-code))))
  62.         syms-and-iso8859/1-codes)
  63.     ;;
  64.     ;; Then emit code that binds all of those keysym symbols to
  65.     ;; `self-insert-command'.
  66.     ;; 
  67.     (mapcar '(lambda (sym-and-code)
  68.            (list 'global-set-key (list 'quote (car sym-and-code))
  69.              ''self-insert-command))
  70.         syms-and-iso8859/1-codes)
  71.     ;;
  72.     ;; Then emit the value of iso8859/1-code-to-x-keysym-table.
  73.     ;;
  74.     (let ((v (make-vector 256 nil)))
  75.       ;; the printing ASCII chars have 1-char names.
  76.       (let ((i 33))
  77.         (while (< i 127)
  78.           (aset v i (intern (make-string 1 i)))
  79.           (setq i (1+ i))))
  80.       ;; these are from the keyboard character set.
  81.       (mapcar '(lambda (x) (aset v (car x) (car (cdr x))))
  82.           '((8 backspace) (9 tab) (10 linefeed) (13 return)
  83.             (27 escape) (32 space) (127 delete)))
  84.       (mapcar '(lambda (sym-and-code)
  85.              (or (aref v (car (cdr sym-and-code)))
  86.              (aset v (car (cdr sym-and-code)) (car sym-and-code))))
  87.           syms-and-iso8859/1-codes)
  88.       (list (list 'setq 'iso8859/1-code-to-x-keysym-table v)))
  89.     ))))
  90.  
  91.  ;; The names and capitalization here are as per the MIT X11R4 and X11R5
  92.  ;; distributions.  If a vendor varies from this, adjustments will need
  93.  ;; to be made...
  94.  
  95.  (nobreakspace        ?\240)
  96.  (exclamdown        ?\241)
  97.  (cent            ?\242)
  98.  (sterling        ?\243)
  99.  (currency        ?\244)
  100.  (yen            ?\245)
  101.  (brokenbar        ?\246)
  102.  (section         ?\247)
  103.  (diaeresis        ?\250)
  104.  (copyright        ?\251)
  105.  (ordfeminine        ?\252)
  106.  (guillemotleft        ?\253)
  107.  (notsign        ?\254)
  108.  (hyphen        ?\255)
  109.  (registered        ?\256)
  110.  (macron        ?\257)
  111.  (degree        ?\260)
  112.  (plusminus        ?\261)
  113.  (twosuperior        ?\262)
  114.  (threesuperior        ?\263)
  115.  (acute            ?\264)    ; Why is there an acute keysym that is 
  116.  (mu            ?\265)    ; distinct from apostrophe/quote, but 
  117.  (paragraph        ?\266)    ; no grave keysym that is distinct from
  118.  (periodcentered    ?\267)    ; backquote?
  119.  (cedilla        ?\270)
  120.  (onesuperior        ?\271)
  121.  (masculine        ?\272)
  122.  (guillemotright    ?\273)
  123.  (onequarter        ?\274)
  124.  (onehalf        ?\275)
  125.  (threequarters        ?\276)
  126.  (questiondown        ?\277)
  127.  
  128.  (Agrave        ?\300)
  129.  (Aacute        ?\301)
  130.  (Acircumflex        ?\302)
  131.  (Atilde        ?\303)
  132.  (Adiaeresis        ?\304)
  133.  (Aring            ?\305)
  134.  (AE            ?\306)
  135.  (Ccedilla        ?\307)
  136.  (Egrave        ?\310)
  137.  (Eacute        ?\311)
  138.  (Ecircumflex        ?\312)
  139.  (Ediaeresis        ?\313)
  140.  (Igrave        ?\314)
  141.  (Iacute        ?\315)
  142.  (Icircumflex        ?\316)
  143.  (Idiaeresis        ?\317)
  144.  (ETH            ?\320)
  145.  (Ntilde        ?\321)
  146.  (Ograve        ?\322)
  147.  (Oacute        ?\323)
  148.  (Ocircumflex        ?\324)
  149.  (Otilde        ?\325)
  150.  (Odiaeresis        ?\326)
  151.  (multiply        ?\327)
  152.  (Ooblique        ?\330)
  153.  (Ugrave        ?\331)
  154.  (Uacute        ?\332)
  155.  (Ucircumflex        ?\333)
  156.  (Udiaeresis        ?\334)
  157.  (Yacute        ?\335)
  158.  (THORN            ?\336)
  159.  (ssharp        ?\337)
  160.  
  161.  (agrave        ?\340)
  162.  (aacute        ?\341)
  163.  (acircumflex        ?\342)
  164.  (atilde        ?\343)
  165.  (adiaeresis        ?\344)
  166.  (aring            ?\345)
  167.  (ae            ?\346)
  168.  (ccedilla        ?\347)
  169.  (egrave        ?\350)
  170.  (eacute        ?\351)
  171.  (ecircumflex        ?\352)
  172.  (ediaeresis        ?\353)
  173.  (igrave        ?\354)
  174.  (iacute        ?\355)
  175.  (icircumflex        ?\356)
  176.  (idiaeresis        ?\357)
  177.  (eth            ?\360)
  178.  (ntilde        ?\361)
  179.  (ograve        ?\362)
  180.  (oacute        ?\363)
  181.  (ocircumflex        ?\364)
  182.  (otilde        ?\365)
  183.  (odiaeresis        ?\366)
  184.  (division        ?\367)
  185.  (oslash        ?\370)
  186.  (ugrave        ?\371)
  187.  (uacute        ?\372)
  188.  (ucircumflex        ?\373)
  189.  (udiaeresis        ?\374)
  190.  (yacute        ?\375)
  191.  (thorn            ?\376)
  192.  (ydiaeresis        ?\377)
  193.  
  194.  ;; Do the same voodoo for the keypad keys.  I used to bind these to keyboard
  195.  ;; macros (for instance, kp_0 was bound to "0") so that they would track the
  196.  ;; bindings of the corresponding keys by default, but that made the display
  197.  ;; of M-x describe-bindings much harder to read, so now we'll just bind them
  198.  ;; to self-insert by default.  Not a big difference...
  199.  
  200.  (kp_0            ?0)
  201.  (kp_1            ?1)
  202.  (kp_2            ?2)
  203.  (kp_3            ?3)
  204.  (kp_4            ?4)
  205.  (kp_5            ?5)
  206.  (kp_6            ?6)
  207.  (kp_7            ?7)
  208.  (kp_8            ?8)
  209.  (kp_9            ?9)
  210.  (kp_space        ? )
  211.  (kp_tab        ?\t)
  212.  (kp_enter        ?\r)
  213.  (kp_equal        ?=)
  214.  (kp_multiply        ?*)
  215.  (kp_add        ?+)
  216.  (kp_separator        ?,)
  217.  (kp_subtract        ?-)
  218.  (kp_decimal        ?.)
  219.  (kp_divide        ?/)
  220.  )
  221.  
  222. ((macro . (lambda (&rest syms-and-iso8859/1-codes)
  223.         (cons 'progn
  224.           (mapcar '(lambda (sym-and-code)
  225.                  (list 'put (list 'quote (car sym-and-code))
  226.                    ''x-iso8859/1 (car (cdr sym-and-code))))
  227.               syms-and-iso8859/1-codes))))
  228.  ;;
  229.  ;; Let's do the appropriate thing for some vendor-specific keysyms too...
  230.  ;; Apparently nobody agrees on what the names of these keysyms are.
  231.  ;;
  232.  (SunFA_Acute        ?\264)
  233.  (SunXK_FA_Acute    ?\264)
  234.  (Dacute_accent        ?\264)
  235.  (DXK_acute_accent    ?\264)
  236.  (hpmute_acute        ?\264)
  237.  (hpXK_mute_acute    ?\264)
  238.  (XK_mute_acute        ?\264)
  239.  
  240.  (SunFA_Grave         ?`)
  241.  (Dead_Grave         ?`)
  242.  (SunXK_FA_Grave     ?`)
  243.  (Dgrave_accent         ?`)
  244.  (DXK_grave_accent     ?`)
  245.  (hpmute_grave         ?`)
  246.  (hpXK_mute_grave     ?`)
  247.  (XK_mute_grave         ?`)
  248.  
  249.  (SunFA_Cedilla        ?\270)
  250.  (SunXK_FA_Cedilla    ?\270)
  251.  (Dcedilla_accent    ?\270)
  252.  (DXK_cedilla_accent    ?\270)
  253.  
  254.  (SunFA_Diaeresis    ?\250)
  255.  (SunXK_FA_Diaeresis    ?\250)
  256.  (hpmute_diaeresis    ?\250)
  257.  (hpXK_mute_diaeresis    ?\250)
  258.  (XK_mute_diaeresis    ?\250)
  259.  
  260.  (SunFA_Circum         ?^)
  261.  (Dead_Circum         ?^)
  262.  (SunXK_FA_Circum     ?^)
  263.  (Dcircumflex_accent     ?^)
  264.  (DXK_circumflex_accent     ?^)
  265.  (hpmute_asciicircum     ?^)
  266.  (hpXK_mute_asciicircum     ?^)
  267.  (XK_mute_asciicircum     ?^)
  268.  
  269.  (SunFA_Tilde         ?~)
  270.  (Dead_Tilde         ?~)
  271.  (SunXK_FA_Tilde     ?~)
  272.  (Dtilde         ?~)
  273.  (DXK_tilde         ?~)
  274.  (hpmute_asciitilde     ?~)
  275.  (hpXK_mute_asciitilde     ?~)
  276.  (XK_mute_asciitilde     ?~)
  277.  
  278.  (Dring_accent        ?\260)
  279.  (DXK_ring_accent    ?\260)
  280.  )
  281.  
  282. ;;; And do it to the builtins, just to make describe-bindings need to do 
  283. ;;; less work.
  284. ;;;
  285. (put 'backspace 'x-iso8859/1 ?\b)
  286. (put 'tab    'x-iso8859/1 ?\t)
  287. (put 'linefeed    'x-iso8859/1 ?\n)
  288. (put 'return    'x-iso8859/1 ?\r)
  289. (put 'escape    'x-iso8859/1  27)
  290. (put 'space    'x-iso8859/1  ? )
  291. (put 'delete    'x-iso8859/1 ?\177)
  292.  
  293. (provide 'x-iso8859-1)
  294.